﻿<%@ Page Language="C#" MasterPageFile="~/InventoryTracker/MasterPage.master" AutoEventWireup="true" CodeFile="NewGenerated.aspx.cs" Inherits="InventoryTracker_NewGenerated" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="maincontent" Runat="Server">
<h3>Editing individual Grid

        <asp:SqlDataSource ID="DetaildDs" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT [InvoiceItem], [ItemDescription], [InvoiceItemRate], [Tax], [InvoiceTotalAmount], [InvoiceDate], [InvoiceItemQty], [InvoiceDiscount] FROM [InvoiceDetails]">
    </asp:SqlDataSource>
        <asp:SqlDataSource ID="InvSDS" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        DeleteCommand="DELETE FROM InvoiceDetails WHERE (InvoiceNumber = @InvoiceNumber)" 
        InsertCommand="INSERT INTO InvoiceDetails(InvoiceItem, ItemDescription, InvoiceItemRate, Tax, InvoiceTotalAmount, InvoiceItemQty, InvoiceDiscount) VALUES (@InvoiceItem, @ItemDescription, @InvoiceItemRate, @Tax, @InvoiceTotalAmount, @InvoiceItemQty, @InvoiceDiscount)" 
        SelectCommand="SELECT InvoiceItem, ItemDescription, InvoiceItemRate, Tax, InvoiceTotalAmount, InvoiceDate, InvoiceDiscount, InvoiceItemQty FROM InvoiceDetails WHERE (InvoiceNumber = @InvoiceNumber)" 
        UpdateCommand="UPDATE InvoiceDetails SET InvoiceItem = @InvoiceItem, ItemDescription = @ItemDescription, InvoiceItemRate = @InvoiceItemRate, Tax = @Tax, InvoiceTotalAmount = @InvoiceTotalAmount, InvoiceItemQty = @InvoiceItemQty, InvoiceDiscount = @InvoiceDiscount WHERE (InvoiceNumber = @InvoiceNumber)">
            <SelectParameters>
                <asp:Parameter Name="InvoiceNumber" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="InvoiceNumber" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="InvoiceItem" />
                <asp:Parameter Name="ItemDescription" />
                <asp:Parameter Name="InvoiceItemRate" />
                <asp:Parameter Name="Tax" />
                <asp:Parameter Name="InvoiceTotalAmount" />
                <asp:Parameter Name="InvoiceItemQty" />
                <asp:Parameter Name="InvoiceDiscount" />
                <asp:Parameter Name="InvoiceNumber" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="InvoiceItem" />
                <asp:Parameter Name="ItemDescription" />
                <asp:Parameter Name="InvoiceItemRate" />
                <asp:Parameter Name="Tax" />
                <asp:Parameter Name="InvoiceTotalAmount" />
                <asp:Parameter Name="InvoiceItemQty" />
                <asp:Parameter Name="InvoiceDiscount" />
            </InsertParameters>
    </asp:SqlDataSource>
        <asp:SqlDataSource ID="InvDS" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            DeleteCommand="DELETE FROM InvoiceDetails WHERE (InvoiceNumber = @InvoiceNumber)" 
            InsertCommand="INSERT INTO InvoiceDetails(InvoiceItem, InvoiceItemRate, Tax, InvoiceTotalAmount, InvoiceItemQty, InvoiceDiscount) VALUES (@InvoiceItem, @InvoiceItemRate, @Tax, @InvoiceTotalAmount, @InvoiceItemQty, @InvoiceDiscount)" 
            SelectCommand="SELECT * FROM InvoiceDetails" 
            UpdateCommand="UPDATE InvoiceDetails SET InvoiceItem = @InvoiceItem, InvoiceItemRate = @InvoiceItemRate, Tax = @Tax, InvoiceTotalAmount = @InvoiceTotalAmount, InvoiceItemQty = @InvoiceItemQty, InvoiceDiscount = @InvoiceDiscount WHERE (InvoiceNumber = @InvoiceNumber)">
            <DeleteParameters>
                <asp:Parameter Name="InvoiceNumber" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="InvoiceItem" />
                <asp:Parameter Name="InvoiceItemRate" />
                <asp:Parameter Name="Tax" />
                <asp:Parameter Name="InvoiceTotalAmount" />
                <asp:Parameter Name="InvoiceItemQty" />
                <asp:Parameter Name="InvoiceDiscount" />
                <asp:Parameter Name="InvoiceNumber" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="InvoiceItem" />
                <asp:Parameter Name="InvoiceItemRate" />
                <asp:Parameter Name="Tax" />
                <asp:Parameter Name="InvoiceTotalAmount" />
                <asp:Parameter Name="InvoiceItemQty" />
                <asp:Parameter Name="InvoiceDiscount" />
            </InsertParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="NewInvDS" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            SelectCommand="SELECT [ItemName], [ItemDescription], [ItemCode], [SellingRate] FROM [MaterialMaster]">
        </asp:SqlDataSource>
        </h3>
    
    
    <div>        
        <br />
        <asp:Label id="Message" runat="server" CssClass="message"></asp:Label> 
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            DeleteCommand="DELETE FROM [Tasks] WHERE [Id] = @Id" InsertCommand="INSERT INTO [Tasks] ([Description], [AssignedTo], [Status]) VALUES (@Description, @AssignedTo, @Status)"
            SelectCommand="SELECT * FROM [Tasks]" UpdateCommand="UPDATE [Tasks] SET [Description] = @Description, [AssignedTo] = @AssignedTo, [Status] = @Status WHERE [Id] = @Id" >
            <DeleteParameters>
                <asp:Parameter Name="Id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="AssignedTo" Type="String" />
                <asp:Parameter Name="Status" Type="String" />
                <asp:Parameter Name="Id" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="AssignedTo" Type="String" />
                <asp:Parameter Name="Status" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>  
     </div>

<asp:GridView ID="GridView1" runat="server" 
            AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" 
            GridLines="None" DataSourceID="DetaildDs"
            OnRowDataBound="GridView1_RowDataBound" 
            OnRowCommand="GridView1_RowCommand" 
        OnRowUpdating="GridView1_RowUpdating" PageSize="4" 
            
            
        
        
        
        
        style="top: 360px; left: 102px; position: absolute; height: 338px; width: 163px; " >
            <Columns> 
            <asp:ButtonField Text="SingleClick" CommandName="SingleClick" Visible="False"/>               
                <asp:BoundField DataField="InvoiceItem" HeaderText="InvoiceItem" 
                    SortExpression="InvoiceItem" />
                <asp:BoundField DataField="ItemDescription" HeaderText="ItemDescription" 
                    SortExpression="ItemDescription" />
                <asp:BoundField DataField="InvoiceItemRate" HeaderText="InvoiceItemRate" 
                    SortExpression="InvoiceItemRate" />
                <asp:BoundField DataField="Tax" HeaderText="Tax" SortExpression="Tax" />
                <asp:BoundField DataField="InvoiceTotalAmount" HeaderText="InvoiceTotalAmount" 
                    SortExpression="InvoiceTotalAmount" />
                <asp:BoundField DataField="InvoiceDate" HeaderText="InvoiceDate" 
                    SortExpression="InvoiceDate" />
                <asp:BoundField DataField="InvoiceItemQty" HeaderText="InvoiceItemQty" 
                    SortExpression="InvoiceItemQty" />
                <asp:BoundField DataField="InvoiceDiscount" HeaderText="InvoiceDiscount" 
                    SortExpression="InvoiceDiscount" />
                
                
                
                <asp:HyperLinkField />
                
                
                
            </Columns>
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle CssClass="headerStyle" ForeColor="White" BackColor="#5D7B9D" 
                Font-Bold="True" />
            <RowStyle CssClass="rowStyle" BackColor="#F7F6F3" ForeColor="#333333" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle CssClass="alternatingRowStyle" BackColor="White" 
                ForeColor="#284775" />
            <FooterStyle CssClass="footerStyle" BackColor="#5D7B9D" Font-Bold="True" 
                ForeColor="White" />
            <PagerStyle CssClass="pagerStyle" ForeColor="White" BackColor="#284775" 
                HorizontalAlign="Center" />
        </asp:GridView>

</asp:Content>

